function diri = di(rate)


patterns = size(rate,1);
neurons = size(rate,2);

[j mi]=max(rate)

ni=mod(mi-1+patterns/2,patterns)+1;

opt_dir_rate=rate(patterns*(0:neurons-1)+mi)
null_dir_rate=rate(patterns*(0:neurons-1)+ni)


diri=(opt_dir_rate-null_dir_rate)./(opt_dir_rate+null_dir_rate+.000001)

bar(diri);
%figure
%hist(diri(A));
